﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Marbles.Core.Content;
using System.Web.UI.HtmlControls;
using System.ComponentModel;

namespace Marbles.Core.Modules
{
    public abstract class ModuleBase : System.Web.UI.UserControl
    {

        public new Marbles.Core.Pages.Page Page { get { return ((Marbles.Core.Pages.Page)base.Page); } }
        public Authentication.AuthenticationProvider AuthenticationProvider { get { return this.Page.AuthenticationProvider; } }
        public bool IsAuthenticated { get { return (this.AuthenticationProvider == null) ? false : this.AuthenticationProvider.IsAuthenticated; } }
        public Marbles.Core.Content.Pages.PageDefinition CurrentPage { get { return this.Page.CurrentPage; } }
        public Marbles.Core.Content.Sites.SiteDefinition CurrentWeb { get { return this.Page.CurrentWeb; } }
        public HtmlHead Header { get { return this.Page.MasterHeader; } }
        public System.Web.UI.MasterPage Template { get { return this.Page.Master; } }
        
        public abstract string ModuleName { get; }
        public abstract string ModuleAuthor { get; }

        [Description("Runs on Installation of Module by Module Installation Manager")]
        public virtual void Install()
        {
        }

        [Description("Runs on Un-Installation of Module by Module Installation Manager")]
        public virtual void UnInstall()
        {
        }
    }
}
